package com.sbw.application.scaffold.service.impl;

import com.sbw.application.scaffold.controller.request.BizRevenueSearchRequest;
import com.sbw.application.scaffold.controller.vo.BizRevenueReportVO;
import com.sbw.application.scaffold.mapper.HotelBizRevenueReportMapper;
import com.sbw.application.scaffold.model.HotelBizRevenueReport;
import com.sbw.application.scaffold.service.HotelBizRevenueReportService;
import com.sbw.application.scaffold.utils.ConvertBeanUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author: sangbowei
 * @Description:
 * @Date: 2018/9/5 17:49
 */
@Slf4j
@Service
public class HotelBizRevenueReportServiceImpl implements HotelBizRevenueReportService {


	@Resource
	private HotelBizRevenueReportMapper hotelBizRevenueReportMapper;

	@Override
	public List<BizRevenueReportVO> findBizRevenueReportList(BizRevenueSearchRequest searchRequest) {


		List<HotelBizRevenueReport> hotelBizRevenueReports = hotelBizRevenueReportMapper.findBizRevenueReportList(searchRequest);
		if(CollectionUtils.isEmpty(hotelBizRevenueReports)){
			return null;
		}

		List<BizRevenueReportVO> bizRevenueReportVOS = new ArrayList<>();
		ConvertBeanUtils.copyListBeanPropertiesToList(hotelBizRevenueReports,bizRevenueReportVOS,BizRevenueReportVO.class);

		return bizRevenueReportVOS;
	}

}
